package com.huoyun.util.bean;

public class HYException extends Exception {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private static String DEFAULT_CODE = "defalt";

	public HYException() {
		this(DEFAULT_CODE);
	}

	public HYException(final String code) {
		this.errorCode = code;
	}

	/* 错误码 */
	private String errorCode;

	/* 修复建议 */
	private String advice;

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(final String errorCode) {
		this.errorCode = errorCode;
	}

	public String getAdvice() {
		return advice;
	}

	public void setAdvice(final String advice) {
		this.advice = advice;
	}

	@Override
	public String getMessage() {
		if (DEFAULT_CODE.equals(errorCode)) {
			return "操作失败，请检查输入后重新操作";
		} else {
			return "已知错误，建议：" + getAdvice();
		}
	}
}
